#ifndef CNC_COMM_KEYBOARD_COMMAND_ID_H
#define CNC_COMM_KEYBOARD_COMMAND_ID_H

namespace cnc {

	namespace comm {

	//#define CHARACTER                 0x00
		namespace CHARACTER {
			enum {
				ID = 0x00
			};
		}

	//#define KEYSTROKE                 0x01
		namespace KEYSTROKE {
			enum {
				ID = 0x01
			};
		}

	//#define EMERGENCY                 0x02
	//#define EMERGENCY_STOP            0x00
	//#define EMERGENCY_CONTINUE        0x01
		namespace EMERGENCY {
			enum {
				ID = 0x02
			};
			enum {
				STOP     = 0x00,
				CONTINUE = 0x01
			};
		}

	//#define CYCLE                     0x03
	//#define CYCLE_START               0x00
	//#define CYCLE_FEED_HOLD           0x01
		namespace CYCLE {
			enum {
				ID = 0x03
			};
			enum {
				START     = 0x00,
				FEED_HOLD = 0x01
			};
		}

	//#define MODE                      0x04
	//#define MODE_MEMORY               0x00
	//#define MODE_MDI                  0x01
	//#define MODE_FILE_MANAGER         0x02
	//#define MODE_EDITOR               0x03
	//#define MODE_HANDWHEEL            0x04
	//#define MODE_JOG                  0x05
	//#define MODE_RAPID                0x06
	//#define MODE_HOME                 0x07
		namespace MODE {
			enum {
				ID = 0x04
			};
			enum
			{
				MEMORY       = 0x00,
				MDI          = 0x01,
				FILE_MANAGER = 0x02,
				EDITOR       = 0x03,
				HANDWHEEL    = 0x04,
				JOG          = 0x05,
				RAPID        = 0x06,
				HOME         = 0x07,
				END          = 0x08
			};
		}

	//#define OPTION                    0x05
	//#define OPTION_SINGLE_BLOCK_OFF   0x00
	//#define OPTION_SINGLE_BLOCK_ON    0x01
	//#define OPTION_OPTIONAL_STOP_OFF  0x02
	//#define OPTION_OPTIONAL_STOP_ON   0x03
	//#define OPTION_BLOCK_SKIP_OFF     0x04
	//#define OPTION_BLOCK_SKIP_ON      0x05
	//#define OPTION_DRY_RUN_OFF        0x06
	//#define OPTION_DRY_RUN_ON         0x07
	//#define OPTION_MST_LOCK_OFF       0x08
	//#define OPTION_MST_LOCK_ON        0x09
	//#define OPTION_MACHINE_LOCK_OFF   0x0A
	//#define OPTION_MACHINE_LOCK_ON    0x0B
		namespace OPTION {
			enum {
				ID = 0x05
			};
			enum {
				SINGLE_BLOCK_OFF  = 0x00,
				SINGLE_BLOCK_ON   = 0x01,
				OPTIONAL_STOP_OFF = 0x02,
				OPTIONAL_STOP_ON  = 0x03,
				BLOCK_SKIP_OFF    = 0x04,
				BLOCK_SKIP_ON     = 0x05,
				DRY_RUN_OFF       = 0x06,
				DRY_RUN_ON        = 0x07,
				MST_LOCK_OFF      = 0x08,
				MST_LOCK_ON       = 0x09,
				MACHINE_LOCK_OFF  = 0x0A,
				MACHINE_LOCK_ON   = 0x0B
			};
		}

	//#define FEEDRATE_OVERRIDE         0x06
		namespace FEEDRATE_OVERRIDE {
			enum {
				ID = 0x06
			};
		}

	//#define JOG_FEEDRATE              0x07
		namespace JOG_FEEDRATE {
			enum {
				ID = 0x07
			};
		}

	//#define RAPID_FEEDRATE_OVERRIDE   0x08
		namespace RAPID_FEEDRATE_OVERRIDE {
			enum {
				ID = 0x08
			};
		}

	//#define AXIS                      0x09
	//#define AXIS_POSITIVE_IGNORE(i)  (0x00 || (i << 4))
	//#define AXIS_POSITIVE_SELECT(i)  (0x01 || (i << 4))
	//#define AXIS_NEGATIVE_IGNORE(i)  (0x02 || (i << 4))
	//#define AXIS_NEGATIVE_SELECT(i)  (0x03 || (i << 4))
	//#define AXIS_X_POSITIVE_IGNORE    0x00
	//#define AXIS_X_POSITIVE_SELECT    0x01
	//#define AXIS_X_NEGATIVE_IGNORE    0x02
	//#define AXIS_X_NEGATIVE_SELECT    0x03
	//#define AXIS_Y_POSITIVE_IGNORE    0x10
	//#define AXIS_Y_POSITIVE_SELECT    0x11
	//#define AXIS_Y_NEGATIVE_IGNORE    0x12
	//#define AXIS_Y_NEGATIVE_SELECT    0x13
	//#define AXIS_Z_POSITIVE_IGNORE    0x20
	//#define AXIS_Z_POSITIVE_SELECT    0x21
	//#define AXIS_Z_NEGATIVE_IGNORE    0x22
	//#define AXIS_Z_NEGATIVE_SELECT    0x23
		namespace AXIS {
			enum {
				ID = 0x09
			};
			template <int i> struct POSITIVE_IGNORE { enum { ID = 0x00 | (i << 4) }; };
			template <int i> struct POSITIVE_SELECT { enum { ID = 0x01 | (i << 4) }; };
			template <int i> struct NEGATIVE_IGNORE { enum { ID = 0x02 | (i << 4) }; };
			template <int i> struct NEGATIVE_SELECT { enum { ID = 0x03 | (i << 4) }; };
			enum {
				X_POSITIVE_IGNORE = 0x00,
				X_POSITIVE_SELECT = 0x01,
				X_NEGATIVE_IGNORE = 0x02,
				X_NEGATIVE_SELECT = 0x03,
				Y_POSITIVE_IGNORE = 0x10,
				Y_POSITIVE_SELECT = 0x11,
				Y_NEGATIVE_IGNORE = 0x12,
				Y_NEGATIVE_SELECT = 0x13,
				Z_POSITIVE_IGNORE = 0x20,
				Z_POSITIVE_SELECT = 0x21,
				Z_NEGATIVE_IGNORE = 0x22,
				Z_NEGATIVE_SELECT = 0x23
			};
		}

	//#define SPINDLE                   0x0A
	//#define SPINDLE_NORMAL_ROTATION   0x00
	//#define SPINDLE_REVERSE_ROTATION  0x01
	//#define SPINDLE_START             0x02
	//#define SPINDLE_STOP              0x03
		namespace SPINDLE {
			enum {
				ID = 0x0A
			};
			enum {
				NORMAL_ROTATION  = 0x00,
				REVERSE_ROTATION = 0x01,
				START            = 0x02,
				STOP             = 0x03
			};
		}

	//#define SPINDLE_SPEED             0x0B
		namespace SPINDLE_SPEED {
			enum {
				ID = 0x0B
			};
		}

	//#define SPINDLE_OVERRIDE          0x0C
		namespace SPINDLE_OVERRIDE {
			enum {
				ID = 0x0C
			};
		}

	//#define HANDWHEEL                 0x0D
	//#define HANDWHEEL_FACTOR_1        0x01
	//#define HANDWHEEL_FACTOR_10       0x02
	//#define HANDWHEEL_FACTOR_100      0x03
	//#define HANDWHEEL_DECREASE        0x04
	//#define HANDWHEEL_INCREASE        0x05
	//#define HANDWHEEL_SELECT_AXIS(i) (0x06 + i)
	//#define HANDWHEEL_SELECT_AXIS_X   0x06
	//#define HANDWHEEL_SELECT_AXIS_Y   0x07
	//#define HANDWHEEL_SELECT_AXIS_Z   0x08
		namespace HANDWHEEL {
			enum {
				ID = 0x0D
			};
			enum {
				DECREASE      = 0x00,
				INCREASE      = 0x01,
				FACTOR_1      = 0x02,
				FACTOR_10     = 0x03,
				FACTOR_100    = 0x04,
				SELECT_AXIS_X = 0x05,
				SELECT_AXIS_Y = 0x06,
				SELECT_AXIS_Z = 0x07
			};
			template <int i> struct SELECT_AXIS { enum { ID = 0x05 + i }; };
		}

	//#define TOOL                      0x0E
		namespace TOOL {
			enum {
				ID = 0x0E
			};
		}

	//#define DEVICE                    0x0F
	//#define DEVICE_DISABLE(i)        (0x00 | (i << 4))
	//#define DEVICE_ENABLE(i)         (0x01 | (i << 4))
	//#define DEVICE_AUTOMATIC(i)      (0x02 | (i << 4))
		namespace DEVICE {
			enum {
				ID = 0x0F
			};
			template <int i> struct DISABLE   { enum { ID = 0x00 | (i << 4) }; };
			template <int i> struct ENABLE    { enum { ID = 0x01 | (i << 4) }; };
			template <int i> struct AUTOMATIC { enum { ID = 0x02 | (i << 4) }; };
		}

	} // namespace comm

} // namespace cnc

#endif
